home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_300 / 352_01 / veczsub.cpp < prev    next >
C/C++ Source or Header  |  1991-04-22  |  1KB  |  62 lines

  1. //////// COMPLEX VECTORS
  2. //
  3. //        primary subroutines to support complex vector math :
  4. //        subtraction.
  5. //
  6.  
  7. #include <stdlib.h>
  8. #include <alloc.h>
  9. #include <string.h>
  10. #include "wtwg.h"
  11.  
  12. #include "dblib.h"
  13.  
  14. #include "vector.h"
  15.  
  16.  
  17.     CVector& CVector::operator-=(CVector&  z)
  18.         // subtract CVector z from CVector this.
  19.         {
  20.         if ( ispolar || z.ispolar )    werror ( 'V', "ADDING POLAR VECTORS" );
  21.         
  22.         x -= z.x;
  23.         y -= z.y;
  24.  
  25.         return *this;
  26.         }
  27.  
  28.  
  29.     CVector& CVector::operator-=(complex z)
  30.         // Subtract complex z from CVector this
  31.         {
  32.         if ( ispolar ) werror ( 'V', "ADDING POLAR VECTORS" );
  33.         
  34.         x -= real (z);
  35.         y -= imag (z);
  36.  
  37.         return *this;
  38.         }
  39.  
  40.  
  41.     CVector& CVector::operator-=(Vector&  vec)
  42.         // subtract real Vector vec from CVector this.
  43.         {
  44.         if ( ispolar )    werror ( 'V', "ADDING POLAR VECTORS" );
  45.         
  46.         x -= vec;
  47.         
  48.         return *this;
  49.         }
  50.  
  51.  
  52.     CVector& CVector::operator-=(float  f)
  53.         // Subtract float f from CVector this
  54.         {
  55.         if ( ispolar )    werror ( 'V', "ADDING POLAR VECTORS" );
  56.         
  57.         x -= f;
  58.  
  59.         return *this;
  60.         }
  61. //---------------------end VECZSUB.CPP -----------------------------
  62.